package com.baidu.mapapi;

import android.graphics.Point;
import android.os.Bundle;

class d
  implements Projection
{
  private MapView a = null;

  public d(MapView paramMapView)
  {
    this.a = paramMapView;
  }

  Point a(GeoPoint paramGeoPoint, Point paramPoint)
  {
    Point localPoint;
    Bundle localBundle = new Bundle();
    localBundle.putInt("act", 15010200);
    localBundle.putInt("x", paramGeoPoint.getLongitudeE6());
    localBundle.putInt("y", paramGeoPoint.getLatitudeE6());
    Mj.sendBundle(localBundle);
    if (paramPoint == null)
      localPoint = new Point(0, 0);
    while (true)
    {
      localPoint.x = localBundle.getInt("x");
      localPoint.y = localBundle.getInt("y");
      return localPoint;
      localPoint = paramPoint;
    }
  }

  public GeoPoint fromPixels(int paramInt1, int paramInt2)
  {
    int k;
    int l;
    int i = paramInt1 - this.a.b.c;
    int j = paramInt2 - this.a.b.d;
    if (this.a.b.e != 1D)
    {
      int i2 = (int)((i - this.a.b.f) / this.a.b.e);
      int i3 = (int)((j - this.a.b.g) / this.a.b.e);
      int i4 = i2 + this.a.b.f;
      int i5 = i3 + this.a.b.g;
      k = i4;
      l = i5;
    }
    while (true)
    {
      Bundle localBundle = new Bundle();
      localBundle.putInt("act", 15010100);
      localBundle.putInt("x", k);
      localBundle.putInt("y", l);
      Mj.sendBundle(localBundle);
      int i1 = localBundle.getInt("x");
      return new GeoPoint(localBundle.getInt("y"), i1);
      k = i;
      l = j;
    }
  }

  public float metersToEquatorPixels(float paramFloat)
  {
    return (float)(paramFloat / this.a.f());
  }

  public Point toPixels(GeoPoint paramGeoPoint, Point paramPoint)
  {
    Point localPoint;
    Bundle localBundle = new Bundle();
    localBundle.putInt("act", 15010200);
    localBundle.putInt("x", paramGeoPoint.getLongitudeE6());
    localBundle.putInt("y", paramGeoPoint.getLatitudeE6());
    Mj.sendBundle(localBundle);
    if (paramPoint == null)
      localPoint = new Point(0, 0);
    while (true)
    {
      localPoint.x = localBundle.getInt("x");
      localPoint.y = localBundle.getInt("y");
      if (this.a.b.e != 1D)
      {
        int i = (int)(0.5D + (localPoint.x - this.a.b.f) * this.a.b.e);
        int j = (int)(0.5D + (localPoint.y - this.a.b.g) * this.a.b.e);
        localPoint.x = (i + this.a.b.f);
        localPoint.y = (j + this.a.b.g);
      }
      localPoint.x += this.a.b.c;
      localPoint.y += this.a.b.d;
      return localPoint;
      localPoint = paramPoint;
    }
  }
}